import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AppTypeVO, AppTypeForm, AppTypeQuery } from '@/api/application/appType/types';

/**
 * 查询应用类型列表
 * @param query
 * @returns {*}
 */

export const listAppType = (query?: AppTypeQuery): AxiosPromise<AppTypeVO[]> => {
  return request({
    url: '/application/appType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询应用类型详细
 * @param appTypeId
 */
export const getAppType = (appTypeId: string | number): AxiosPromise<AppTypeVO> => {
  return request({
    url: '/application/appType/' + appTypeId,
    method: 'get'
  });
};

/**
 * 新增应用类型
 * @param data
 */
export const addAppType = (data: AppTypeForm) => {
  return request({
    url: '/application/appType',
    method: 'post',
    data: data
  });
};

/**
 * 修改应用类型
 * @param data
 */
export const updateAppType = (data: AppTypeForm) => {
  return request({
    url: '/application/appType',
    method: 'put',
    data: data
  });
};

/**
 * 删除应用类型
 * @param appTypeId
 */
export const delAppType = (appTypeId: string | number | Array<string | number>) => {
  return request({
    url: '/application/appType/' + appTypeId,
    method: 'delete'
  });
};
